<template>
  <div>
    <router-link v-for="(item, index) in list" :key="index" :to="`/studentCheck?id=${item.id}`">
      <div class="user-item">
        <div class="avatar">
          <img :src="item.head_sculpture ? item.head_sculpture : avatar" alt="" width="50">
        </div>
        <div class="name">
          <span>{{ item.name }}</span>
        </div>
      </div>
    </router-link>
  </div>
</template>

<script>
import api from '@/api'
export default {
  name: 'to-check-student-list',
  data () {
    return {
      avatar: require('@/assets/img/icon-avatar.png'),
      list: []
    }
  },
  methods: {
    getList () {
      let params = {
        teacher_id: JSON.parse(sessionStorage.getItem('user')).id
        // teacher_id: '1'
      }
      api.teacherGetStudentr({
        params,
        callback: res => {
          this.list = res.data.data
        }
      })
    }
  },
  created () {
    this.getList()
  }
}
</script>

<style scoped>
  .user-item{
    display: flex;
    padding: 10px 0 0 10px;
    align-items: center;
  }
  .user-item .avatar{
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-grow: 0;
    flex-shrink: 0;
  }
  .user-item .name{
    display: flex;
    flex-grow: 1;
    flex-shrink: 1;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.3);
    height: 50px;
    margin-left: 20px;
    font-family: PingFangBlod;
    padding-right: 10px;
    color: #1E1E1E;
  }
</style>
